﻿// See https://aka.ms/new-console-template for more information
using ServiceStack.Redis;

Console.WriteLine("Hello, World!");
using (IRedisClient client=new RedisClient("127.0.0.1", 6379))
{
    #region 单个操作
    //TODO  删除当前数据库中的所有数据
    client.FlushAll();
    Console.WriteLine("任意键写入值。。。");

    Console.ReadLine();
    client.Set<string>("Name", "Manson");

    var result = client.Get<string>("Name");
    Console.WriteLine($"写入结果{result}");
    #endregion


    #region 批量操作
    Dictionary<string,string> dic=new Dictionary<string,string>();
    dic.Add("id", "00022");
    dic.Add("name", "张三");
    dic.Add("address", "南京");
    client.SetAll(dic);


    var List = client.GetAll<string>(new List<string> { "id","name","address"});

    string value = String.Join(",", List);
    Console.WriteLine(value);

    #endregion



}
